package com.allwees.bs.c.module.user.listener;

import com.allwees.bs.c.module.user.dto.UserDto;
import com.allwees.bs.c.module.user.event.OAuthUserRegisteredEvent;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import org.springframework.transaction.event.TransactionalEventListener;

/**
 * @author yangylsky
 * @since 2019-08-16
 */
@Slf4j
@Component
public class OAuthUserRegisteredListener extends BaseUserRegisteredListener {

    @TransactionalEventListener
    public void onEvent(OAuthUserRegisteredEvent event) {
        UserDto userDto = (UserDto) event.getSource();
        log.info("oauth user registered event[email:{}]", userDto.getEmail());
        userRegistered(userDto,true);
    }
}
